@using BlazorApp.Pages.Common.Html.HTable
@using BlazorApp.Pages.Common.Metadata
@using BlazorApp.Pages.Event
@using BlazorApp.Pages.Gateway.Share
@using BlazorApp.Pages.Service
@using k8s.Models
@inherits BlazorApp.Pages.Common.DrawerPageBase<Entity.Crd.Gateway.V1Alpha2UDPRoute>
@if (UdpRoute != null)
{
    <UdpRouteAction Item="UdpRoute" MenuMode="MenuMode.Horizontal"></UdpRouteAction>
    <Divider Orientation="left" Style="font-weight:bold">@L["Metadata"]</Divider>
    <MetadataView Item="UdpRoute.Metadata" ExplainFieldPrefix="udpRoute"></MetadataView>

    <Divider Orientation="left" Style="font-weight:bold">@L["Parent"]</Divider>
    <RouteParentRefsView ParentRefs="UdpRoute.Spec.ParentRefs"
                         ExplainFieldPrefix="udpRoute.spec.parentRefs">
    </RouteParentRefsView>

    @if (UdpRoute.Spec.Rules is { Count: > 0 })
    {
        <Divider Orientation="left" Style="font-weight:bold">@L["Rules"]</Divider>
        <HTable Bordered Column="1">
            @foreach (var rule in UdpRoute.Spec.Rules)
            {
                <BackendRefsView BackendRefWithWeight="@rule.BackendRefs" ExplainField="udpRoute.spec.rules.backendRefs"
                                 Ns="@UdpRoute.Metadata.Namespace()">
                </BackendRefsView>
            }
        </HTable>
    }


    @if (UdpRoute.Status is not null)
    {
        <Divider Orientation="left" Style="font-weight:bold">@L["Status"]</Divider>
        <HTable Bordered Column="1">
            <RouteParentStatusView Parents="@UdpRoute.Status.Parents"
                                   ExplainFieldPrefix="updRoute"
                                   Ns="@UdpRoute.Metadata.Namespace()">
            </RouteParentStatusView>
        </HTable>
    }

    @if (_svcList is { Count: > 0 })
    {
        <MiniServiceListView Services="@_svcList"></MiniServiceListView>
    }

    <MiniEventListView Uid="@UdpRoute.Metadata.Uid"></MiniEventListView>
}
